Skip to content

fix(shared): share request context stores across duplicated modules - #15395

Merged
diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.52from
maxmad64bis:fix/share-request-context-symbol-for
Oct 6, 2026
Merged

diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.52from
maxmad64bis:fix/share-request-context-symbol-for

Conversation

@maxmad64bis

@maxmad64bis maxmad64bis commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ base-red inherited: #15306

Summary

The correlation id and request id stores were still module-level AsyncLocalStorage instances, the pattern #14620 moved off for the proxy context: when bundling duplicates one of these modules, the copy that opens the context isn't the one that reads it, and the read falls back to the empty value. Both stores now key off globalThis via Symbol.for, so a read from any copy sees the context opened by any other copy; without duplication nothing changes.

Related Issues

Validation

  • Change type: other
  • Focused tests and category gates from the golden path
  • npm run lint — ESLint on the touched files is clean; the full run is red on the base (🔴 Release branch not green: release/v3.8.52 #15306).
  • Reconciled with the current active release base; focused checks rerun afterward
  • Production-code changes include a new or updated automated test in this PR

Tests Added Or Updated

  • tests/unit/share-request-context-symbol-for.test.ts — cross-copy interleaving for both stores, plus sequential isolation and out-of-context empty values.

Coverage Notes

  • The correlation middleware store is covered by the new cross-copy test, including the sequential-isolation case.
  • The request identifier store is covered by the new cross-copy test, including the out-of-context empty value case.

Reviewer Notes

N/A — nothing beyond the Summary changes the review.

Stores lived per module copy, so context opened by one copy was unreadable from another; both now key off the shared registry, proven by a cross-copy interleaving test.
@maxmad64bis
maxmad64bis force-pushed the fix/share-request-context-symbol-for branch from b9210dc to 00ee433 Compare October 2, 2026 22:37
@maxmad64bis
maxmad64bis marked this pull request as ready for review October 3, 2026 01:40
@diegosouzapw
diegosouzapw merged commit 9e97f04 into diegosouzapw:release/v3.8.52 Oct 6, 2026
149 of 200 checks passed
@maxmad64bis
maxmad64bis deleted the fix/share-request-context-symbol-for branch October 7, 2026 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants